UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '64It1FyTW5gaPHYqf2Cb6ir2hBg8pvLDr8JGOUA96Wc=' 
WHERE 
  key_id = 'eced362182178b37e1a3faf5dc2206efb852dac43aeaf7284333933d8978198b' 
  AND (
    token = '64It1FyTW5gaPHYqf2Cb6ir2hBg8pvLDr8JGOUA96Wc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052