UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NvXfNaoqP75jx2iZUdHh9YDA0SZQ5eDbtuw99SeAoX8=' 
WHERE 
  key_id = '86b4e2b652a003af63af1105debe3e97d69b80e62c10cad264302e53035d4601' 
  AND (
    token = 'NvXfNaoqP75jx2iZUdHh9YDA0SZQ5eDbtuw99SeAoX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069