UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6jy8TVw9Xtge6L97GvB4FV1rfiiV5U4pR505yucK6C4=' 
WHERE 
  key_id = '36ba21c4f24f15eb44464163f7129e2800a521c4790b174af7bedd8e9906f882' 
  AND (
    token = '6jy8TVw9Xtge6L97GvB4FV1rfiiV5U4pR505yucK6C4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063