UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+Ha42GlbwDL2eetwPu51QH4xvuBTk2HwQH16wjCrbAY=' 
WHERE 
  key_id = 'd5de317e19fcb80172a9e93756d4b02f91f459d69e14af9c489428186537edb4' 
  AND (
    token = '+Ha42GlbwDL2eetwPu51QH4xvuBTk2HwQH16wjCrbAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030