UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ErRPT13cMxS0Faf/8NcQOp9W8xXALSs+nmqtKqaRgvs=' 
WHERE 
  key_id = '40dcc407b0871b8885a6a9cb9deeb6e98107d9a661f57ab71983ce1dc02b9b63' 
  AND (
    token = 'ErRPT13cMxS0Faf/8NcQOp9W8xXALSs+nmqtKqaRgvs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034