UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zrBucgWzxpPOaiE4230kf0hc2QRgyRS3RcVovrYwKxI=' 
WHERE 
  key_id = 'bf11472e9966b7e546caec1061dc66d35c0bf803869369ce9deff7fe70571c32' 
  AND (
    token = 'zrBucgWzxpPOaiE4230kf0hc2QRgyRS3RcVovrYwKxI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034