UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CzUniheFTy7nacuPEIcqf5NIawVNk4CJOj/SYWozF+E=' 
WHERE 
  key_id = '522802ffaf5744f032cb48fdb46049e95a3217fd0f0e93024e5e42460c3837c6' 
  AND (
    token = 'CzUniheFTy7nacuPEIcqf5NIawVNk4CJOj/SYWozF+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055