UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BrmQsENvE6yNveVGWSfm7ob2c0IWoCjVZlXtlA9L+Lc=' 
WHERE 
  key_id = 'd6d1b4b8ebda49a3247680b14ae0cea09fe18d7195b3211e5f44c8778bb62d49' 
  AND (
    token = 'BrmQsENvE6yNveVGWSfm7ob2c0IWoCjVZlXtlA9L+Lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028