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

Query time 0.00034