UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jw4b7dMh051d/Q58k7b7z7KvKMB2NgrVdBLwWxkCQQ4=' 
WHERE 
  key_id = '0c38a5717caf0547b2f19b9f69005f561a423573d88d6671dc713b447950c680' 
  AND (
    token = 'Jw4b7dMh051d/Q58k7b7z7KvKMB2NgrVdBLwWxkCQQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043