UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q2SlGyi4XjoumjAXSgq0w/sNBh1abGxvjC4Mmn8X/R8=' 
WHERE 
  key_id = '7f9e835339b1bbc7beff5f455043dff373ef27bbab0787ff907dfb7fd4020ea4' 
  AND (
    token = 'Q2SlGyi4XjoumjAXSgq0w/sNBh1abGxvjC4Mmn8X/R8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031