UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y7mFB+fakpxqeqA86CvpxAdM391ltjO5P2QwS/1qXko=' 
WHERE 
  key_id = 'd9ac7f36d7ce49bb6e0fe032966f79f8074e3f0620333ab856f1233d6a1bf293' 
  AND (
    token = 'Y7mFB+fakpxqeqA86CvpxAdM391ltjO5P2QwS/1qXko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032