UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aQCCeXVYVqYLVV1kjHQgwwKk0DyT1QOblymKBnJ8y0I=' 
WHERE 
  key_id = '0848c94ff0691061df3656e380a1b3a1f4dfe670cebe7f29da2bc5cc4a65b80b' 
  AND (
    token = 'aQCCeXVYVqYLVV1kjHQgwwKk0DyT1QOblymKBnJ8y0I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030