UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3OtEAPGK/rsTiVDbnOJj5Q5Za4s8jJ/oo115as/DADw=' 
WHERE 
  key_id = '4a277a77a6390b0c18351c26a91d638163682154258b93526fa94a856c7dcc11' 
  AND (
    token = '3OtEAPGK/rsTiVDbnOJj5Q5Za4s8jJ/oo115as/DADw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034