UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fcf5ruXTsb/wa6GBMsqE7djNtLCfPgyLoJKGzxRgmuA=' 
WHERE 
  key_id = '6518db3e00741e0cd7a00a423bc713ff61d8fd8c9680e0842e902351385996c4' 
  AND (
    token = 'Fcf5ruXTsb/wa6GBMsqE7djNtLCfPgyLoJKGzxRgmuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036