UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BZHEgK3uS3Tw6O8EFfMtI/koE+1RRKJtT8+9UiDDQSY=' 
WHERE 
  key_id = 'f0bcca40b82550076d3aa2206d38355dc9c89fc28e8fd2e12e38b7a8f888f92d' 
  AND (
    token = 'BZHEgK3uS3Tw6O8EFfMtI/koE+1RRKJtT8+9UiDDQSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030