UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clCSNuOGql/tHn7KTHAup0ZmAP2H/EXwL8m+6MVvSjw=' 
WHERE 
  key_id = '1fbf22c7bcb6d3a1e44f62cf6a691fafa7c6d72fed00dda96552f30f782af684' 
  AND (
    token = 'clCSNuOGql/tHn7KTHAup0ZmAP2H/EXwL8m+6MVvSjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032