UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wiScQrINBvufkFeMAh1+nbND7RTr9bcCkGamarUE9hc=' 
WHERE 
  key_id = 'f6af557764a6433ad1c98b54786dbf6845a18e7d9fe1a1db8462c5158085d7dc' 
  AND (
    token = 'wiScQrINBvufkFeMAh1+nbND7RTr9bcCkGamarUE9hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073