UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GcfPtnkA+aFR1Izzb12i+rqUSVb0tUOR1mKn9dALVoY=' 
WHERE 
  key_id = '779b729189559075e86eda16361b28ab55ec26be05eb33ffd7acdae4a5d43f57' 
  AND (
    token = 'GcfPtnkA+aFR1Izzb12i+rqUSVb0tUOR1mKn9dALVoY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037