UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oNJ9ngtjYGuOKqXPb5ElOk0ZnZ1shUCbsU9vnQGnB+k=' 
WHERE 
  key_id = 'b4df8420a4125512b97f920546314ee527bc21ceef7a6d8b8aa049fa987ff781' 
  AND (
    token = 'oNJ9ngtjYGuOKqXPb5ElOk0ZnZ1shUCbsU9vnQGnB+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039