UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EfaYQ6i2k9Qbs4ZSAlhmC6EgkrCN/HkbYUK8EiJcDo4=' 
WHERE 
  key_id = '5045dd33b041473664d5630cac258b0740238886fddfb13c431232df6901a11c' 
  AND (
    token = 'EfaYQ6i2k9Qbs4ZSAlhmC6EgkrCN/HkbYUK8EiJcDo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051