UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Asndh27B3AaVmIoj7fyL78wp2q+8IZc0/ZI2gr7se6w=' 
WHERE 
  key_id = '7d5da82a88b49dcef7f5a043d6b331d6f1c03478ad450c3ad52e4e8e997956b9' 
  AND (
    token = 'Asndh27B3AaVmIoj7fyL78wp2q+8IZc0/ZI2gr7se6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050