UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'na16DY6Evi/LQUD2N1ORyxeAtSLhAHAVy8CDeqlOL4s=' 
WHERE 
  key_id = '49ba80111b211ac014a2a071e974f181f3bc3637b4887473f8c83c49d4f779ee' 
  AND (
    token = 'na16DY6Evi/LQUD2N1ORyxeAtSLhAHAVy8CDeqlOL4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034