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

Query time 0.00049