UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JgEwjI7GZ4cI7LX76yFuHSMKMq2DE1JdvPDSfSstZ6Y=' 
WHERE 
  key_id = '4c45c8138a9c80ab3e553f8497300dd8c113e9013d529ff843f7c4f5c1bf9df1' 
  AND (
    token = 'JgEwjI7GZ4cI7LX76yFuHSMKMq2DE1JdvPDSfSstZ6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038