UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vRUe7z6wpyZqSk2O8mRxD4zlvnQ4R3qhGPFt9BNyhP8=' 
WHERE 
  key_id = '8c2b9137b8ab6941927ec23f78436e282577f60848c4f17f00d381b90d8f1a21' 
  AND (
    token = 'vRUe7z6wpyZqSk2O8mRxD4zlvnQ4R3qhGPFt9BNyhP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034