UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RSfo3RCWhMrN1ivaFgLKp3lMmglCJfQ+m/WeUqGO0uI=' 
WHERE 
  key_id = '072be3fa5abb7969272df1e509aa97643797d214f40cf71b8d3c8582d6082d46' 
  AND (
    token = 'RSfo3RCWhMrN1ivaFgLKp3lMmglCJfQ+m/WeUqGO0uI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027