UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWqq4wKMYcLYcBlJPzNA90yxKtAsSdVLDLU8QIMty1Q=' 
WHERE 
  key_id = '95e4312e077390b6d907c71c55bd2e4bf5e19c5d264e63e9a7a9983627067677' 
  AND (
    token = 'gWqq4wKMYcLYcBlJPzNA90yxKtAsSdVLDLU8QIMty1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033